//! 错误定义

use thiserror::Error;

pub type HadesCryptoResult<T> = Result<T, HadesCryptoError>;

/// 当前crate统一的错误定义
#[derive(Error, Debug, Clone)]
pub enum HadesCryptoError {
    #[error("base64 decode error: {0}")]
    Base64(#[from] base64::DecodeError),

    #[error("public key string decoded error: {0}")]
    PublicKeyDeCode(String),

    #[error("private ket string decoded error: {0}")]
    PrivateKeyDecode(String),

    #[error("sign a value error: {0}")]
    Sign(String),

    #[error("verity a sign error: {0}")]
    Verify(String),

    #[error("encrypt a string error: {0}")]
    Encrypt(String),

    #[error("decrypt a data error: {0}")]
    Decrypt(String),
    // 其他crate过来的错误
    #[error("some other errors occurs: {0}")]
    Other(String),
}
